<template>
    <view class="app">
        <view class="app-container text-center">
            <view class="flex flex-direction justify-center">
                <view class="bg-img"></view>
                <view class="text-xsl padding">
                    <text class="cuIcon-roundcheckfill text-primary"></text>
                </view>
                <text v-if="code" class="text-primary text-lg padding">
                    已上传成功，可通过输入CODE开始
                    打印文档，使用后CODE会失效
                    无法进行二次打印，如忘记CODE
                    可进入（ 我的 > 历史打印） 查看
                </text>
				<text v-else class="text-primary text-lg padding">
				    已上传成功，请暂时退出小程序
				    等待接收待付款消息
				    完成付款后，即可进入
				    （ 我的 > 历史打印） 查看订单
				</text>
                <text class="code text-default text-sl text-bold padding">{{code}}</text>
            </view>
            <view class="action">
                <!-- <navigator url="/community-pages/publish">
                    <button class="cu-btn block box-shadow bg-primary margin-tb-sm lg">
                        麻烦代拿
                    </button>
                </navigator> -->
                <navigator url="/pages/tabbar/index" open-type="switchTab">
                    <button class="cu-btn back block box-shadow line-primary margin-tb-sm lg">
                        返回
                    </button>
                </navigator>
            </view>
        </view>
    </view>
</template>

<script>
	import {getCloudPrintOrderCode} from '@/api/pay.js'
    export default {
        onLoad(options) {
			this.params = options
        },
        onShow() {
            this.getOrderDetails()
        },
        data() {
            return {
				params: {
					//云打印订单id
					print_order_id: '',
					//支付方式，1为余额支付，2为微信支付
					type: ''
				},
                code: ''
            }
        },
        methods: {
            getOrderDetails() {
				const {print_order_id, type} = this.params
				getCloudPrintOrderCode({
					print_order_id: print_order_id,
					type: type
				}).then(res => {
					this.code = res.result.code
				})
            }
        }

    }
</script>

<style lang="scss">
    .app-container {
        height: 100%;
        position: relative;

        .flex {
            height: 50%;
            position: relative;
        }

        .bg-img {
            opacity: 0.5;
            height: 100%;
            width: 100%;
            position: absolute;
            // background-image: url(~@/static/img/tinified/资源6.png);
        }

        .action {
            bottom: 36px;
            left: 16px;
            right: 16px;
            position: absolute;
            height: 35%;

            .back {
                background: #fff !important;
            }
        }
    }
</style>
